package com.star.area.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.star.area.dao.model.CountryAssociatedInfoEntity;
@Repository
public interface CountryAssociatedInfoEntityRepository extends JpaRepository<CountryAssociatedInfoEntity, Long>,
		JpaSpecificationExecutor<CountryAssociatedInfoEntity> {
	@Query(nativeQuery = true, value = "select * from country_associated_info where fk_country_id = ?1")
	CountryAssociatedInfoEntity getByFKCountryId(Long fkCountryId);
	@Query(nativeQuery = true, value = "select * from country_associated_info where fk_country_id in (?1)")
	List<CountryAssociatedInfoEntity> getByFKCountryIds(List<Long> ids);
	@Query(nativeQuery = true, value = "select * from country_associated_info where code = ?1")
	CountryAssociatedInfoEntity getByCode(String code);
	@Query(nativeQuery = true, value = "select * from country_associated_info where boss_status=1 order by fk_country_id")
	List<CountryAssociatedInfoEntity> getBossOnline();
	@Query(nativeQuery = true, value = "select * from country_associated_info where portal_online=1 order by fk_country_id,portal_order")
	List<CountryAssociatedInfoEntity> getPortalOnline();
	@Query(nativeQuery = true, value = "select * from country_associated_info info where info.online=1 order by info.fk_country_id")
	List<CountryAssociatedInfoEntity> getAllOnLine();
	
	
}
